package com.woniuxy.service.impl;

import com.woniuxy.domain.Product;
import com.woniuxy.service.IProductService;
import com.woniuxy.util.Constants;
import com.woniuxy.util.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
//该后备服务实现类不能打印具体异常信息（何种原因导致后备调用）
@Service
@Slf4j
public class ProductServiceFallback implements IProductService {
    @Override
    public ResultVO findById(Integer pid) {
        Product product = new Product();
        product.setPid(-1);
        product.setPname("备用商品");
        product.setStock(100);
        log.error("此后备方法无法打印具体异常信息");
        return new ResultVO(Constants.OPER_SUCCESS, "后备方法findByPid执行了", product);
    }

    @Override
    public ResultVO reduceProductStock(Product product) {
        return null;
    }

    @Override
    public ResultVO testLoadBalance() {
        return new ResultVO(Constants.OPER_SUCCESS, "后备方法testLoadBalance执行了");
    }


    @Override
    public ResultVO addProduct(Product product) {
        return null;
    }
}
